package cn.edu.stu.syllabus.widgets;

import android.annotation.SuppressLint;
import android.os.Build;

import com.orhanobut.logger.Logger;

import java.lang.reflect.Method;

/**
 * Created by daidaijie on 2017/4/24.
 */

public class FlymeUtils {

    public static boolean isFlyme() {
        try {
            final Method method = Build.class.getMethod("hasSmartBar");
            return method != null;
        } catch (final Exception e) {
            return false;
        }
    }

    @SuppressLint({"DefaultLocale"})
    public static boolean isYunOS() {
        String version = null;
        String vmName = null;

        try {
            Method m = Class.forName("android.os.SystemProperties").getMethod("get", new Class[]{String.class});
            version = (String) m.invoke((Object) null, new Object[]{"ro.yunos.version"});
            vmName = (String) m.invoke((Object) null, new Object[]{"java.vm.name"});
        } catch (Exception e) {
            e.printStackTrace();
        }

        return vmName != null && vmName.toLowerCase().contains("lemur") || version != null && version.trim().length() > 0;
    }
}
